#include<bits/stdc++.h>
using namespace std;
int a[100005];
bool f[100005],e[100005];
int n;
int main(){
	freopen("duel.in","r",stdin);
	freopen("duel.out","w",stdout);
	cin>>n;
	for(int i=1;i<=n;i++)cin>>a[i];
	sort(a+1,a+n+1);
	int s=1;
	for(int i=1;i<=n;i++){
		if(a[i]==a[1])s++;
	}
	int now=1;
	while(s<=n){
		if(f[s]){
			s++;
			continue;
		}
		e[now]=1;
		f[s]=1;
		now++;s++;
	}
	int ans=0;
	for(int i=1;i<=n;i++){
		if(!e[i])ans++;
	}
	cout<<ans;
	return 0;
}
